package uk.co.hs.domain.web;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

import org.hibernate.annotations.Index;

import uk.co.hs.domain.generic.UtilisoftGenericDomain;

@Entity
@org.hibernate.annotations.Table(appliesTo=WebPasswordHistory.TABLE_NAME,
                                 indexes={@Index(name=WebPasswordHistory.TABLE_NAME + "_IDX_1", columnNames={UtilisoftGenericDomain.PK, UtilisoftGenericDomain.VERSION}),
                                          @Index(name=WebPasswordHistory.TABLE_NAME + "_IDX_2", columnNames={WebPasswordHistory.USER_FK})})
@Table(name=WebPasswordHistory.TABLE_NAME)
public class WebPasswordHistory extends UtilisoftGenericDomain<Long>
{
  private static final long serialVersionUID = 1L;

  protected static final String TABLE_NAME = "WEB_PASSWORD_HISTORY";
  protected static final String USER_FK = "USER_FK";

  private String mPassword;

  public WebPasswordHistory()
  {
    super();
  }

  public WebPasswordHistory(String aPassword)
  {
    super();
    setPassword(aPassword);
  }

  /**
   * Get Historic Password.
   * @return Password.
   */
  @Column(name="PASSWORD", nullable=false, length=32)
  public String getPassword()
  {
    return mPassword;
  }

  /**
   * Set Historic Password.
   * @param aPassword Password.
   */
  public void setPassword(String aPassword)
  {
    mPassword = aPassword;
  }
}
